﻿using System;
using UnityEngine;
using UnityEngine.UI;


public class FollowItem : UserIconItem
{
    public GameObject manObj;
    public GameObject womanObj;

    MiniUserInfo m_Data;
    public MiniUserInfo data => m_Data;

    Action<FollowItem> m_onSelectItem;
    public void Init(MiniUserInfo visit, Action<FollowItem> onSelectMyItem)
    {
        m_Data = visit;
        m_onSelectItem = onSelectMyItem;

        base.Init(visit.name, visit.birthYear, visit.locationCity, (int)visit.height, visit.icon);

        womanObj.SetActive(visit.gender == Gender.woman);
        manObj.SetActive(visit.gender != Gender.woman);
    }

    void OnEnable()
    {
        StartCoroutine(UnityFunctions.AdjustItemsLayout(transform));
    }

    public void OnClick()
    {
        m_onSelectItem?.Invoke(this);
    }
}
